package cn.yh.register.hosp.controller;

import cn.yh.register.common.result.Result;
import cn.yh.register.hosp.service.DepartmentService;
import cn.yh.register.vo.hosp.DepartmentVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "科室管理")
@RequestMapping("/admin/hosp/department")
//@CrossOrigin
@RestController
public class DepartmentController {

    @Autowired
    DepartmentService departmentService;

    @ApiOperation(value = "树形展示科室列表")
    @GetMapping("/getDeptList/{hoscode}")
    public Result< List<DepartmentVo>> findByTree(@PathVariable String hoscode){
        List<DepartmentVo> departmentVoList = departmentService.findDepartmentTree(hoscode);
        return Result.ok(departmentVoList);
    }
}
